package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.EqualRelationExpressionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.IdentifierNotContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.LogicExpressionNotContext;

/**
 * Logic expression not 语法遍历
 * @author zwd
 *
 */
public class LogicExpressionNotVisitor extends AbsCQLParserBaseVisitor<LogicExpressionNotContext>{

	private LogicExpressionNotContext context = null;
	
	public LogicExpressionNotVisitor() {
		context = new LogicExpressionNotContext();
	}
	
	@Override
	protected LogicExpressionNotContext defaultResult() {
		return context;
	}

	@Override
	public LogicExpressionNotContext visitIdentifierNot(@NotNull IdentifierNotContext ctx) {
		context.setNot(true);
		return context;
	}
	
	@Override
	public LogicExpressionNotContext visitEqualRelationExpression(EqualRelationExpressionContext ctx) {
		EqualRelationExpressionVisitor visitor = new EqualRelationExpressionVisitor();
        context.setExpression(visitor.visit(ctx));
        return context;
	}
}
